package com.shcz.migu.utils;

import android.net.Uri;
import android.text.TextUtils;

/**
 * Created by Administrator on 2015/8/10.
 */
public class UrlUtil {
    private static final String HTTP_HEAD = "http://";
    private static final String HTTPS_HEAD = "https://";
    private static final String URI_HEAD = "file://";


    public static String getPathFromUriPath(String uriString) {
        return Uri.parse(uriString).getPath();
    }

    public static boolean isFileUri(String url) {
        if (!TextUtils.isEmpty(url)) {
            return url.startsWith(URI_HEAD);
        }
        return false;
    }

    public static boolean isUrl(String url) {
        if (!TextUtils.isEmpty(url)) {
            return url.startsWith(HTTPS_HEAD)||url.startsWith(HTTP_HEAD);
        }
        return false;
    }

}